% this code is for Jumps and Post-FOMC Announcement Returns in Currency Markets
% this code shows BAS differential for figure 6

clear
clc

load(use 12 hr measure data)

hwbasjdnpre=nan(nhlf,nc);
hwbasjdnpostone=nan(nhlf,nc);
hwbasjdnposttwo=nan(nhlf,nc);
hwbasjdnpostthr=nan(nhlf,nc);

hwbasnojdnpre=nan(nhlf,nc);
hwbasnojdnpostone=nan(nhlf,nc);
hwbasnojdnposttwo=nan(nhlf,nc);
hwbasnojdnpostthr=nan(nhlf,nc);

for j=1:nhlf
    if hwfomc(j-1,1)==1 && hwfomc(j,1)==1
        for i=1:nc
            if hwjdnv(j,i)>0
                hwbasjdnpre(j,i)=nanmean(hwbas(j-2:j-1,i),1);
                hwbasjdnpostone(j,i)=hwbas(j,i);
                hwbasjdnposttwo(j,i)=hwbas(j+1,i);
                hwbasjdnpostthr(j,i)=hwbas(j+2,i);
            end
            if hwjdnv(j,i)==0
                hwbasnojdnpre(j,i)=nanmean(hwbas(j-2:j-1,i),1);
                hwbasnojdnpostone(j,i)=hwbas(j,i);
                hwbasnojdnposttwo(j,i)=hwbas(j+1,i);
                hwbasnojdnpostthr(j,i)=hwbas(j+2,i);
            end
        end
    end
end
clear j

repbasfigure=[nanmean(nanmean(hwbasjdnpre,2),1)-nanmean(nanmean(hwbasnojdnpre,2),1) ...
    nanmean(nanmean(hwbasjdnpostone,2),1)-nanmean(nanmean(hwbasnojdnpostone,2),1) ...
    nanmean(nanmean(hwbasjdnposttwo,2),1)-nanmean(nanmean(hwbasnojdnposttwo,2),1) ...
    nanmean(nanmean(hwbasjdnpostthr,2),1)-nanmean(nanmean(hwbasnojdnpostthr,2),1)];
